<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCartTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('cart', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('good_id');//商品id
            $table->string('specification',16);//参数 记录规格
            $table->integer('number');//数量
            $table->decimal('unit_price',10,2);//商品单价
            $table->decimal('total_price',10,2);//商品总
            $table->decimal('old_unit_price',10,2);//历史商品单价
            $table->decimal('old_total_price',10,2);//历史商品总价
            $table->json('goods');//商品详情
            $table->integer('staff_id');//创建人id
            $table->boolean('available')->default(true);//是否已过期
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('cart');
    }
}
